import {View, Text, StyleSheet, ViewStyle, TextStyle, TouchableOpacity} from 'react-native'
import React, {Component, ReactElement} from 'react'
import styles, {padding} from "../../style/index";

interface LabelCellWithRightCompProps {
    label: {
        text: string,
        textStyle?: TextStyle
    },
    style?: ViewStyle,
    rightCmp: ReactElement<any> | React.Component,
    onPress?: () => void

}

interface LabelCellWithRightCompState {

}


export default class LabelCellWithRightComp extends Component<LabelCellWithRightCompProps, LabelCellWithRightCompState> {


    constructor(props: LabelCellWithRightCompProps) {
        super(props);
    }

    render() {
        const {label, rightCmp, style, onPress} = this.props;
        return (
            <TouchableOpacity activeOpacity={.8} onPress={onPress}>
                <View style={[styles.flexDirectionRowNotFlex, {
                    backgroundColor: "#fff",
                    marginTop: 1
                }, styles.justifyBetween, styles.centerH, padding(15, 20), style]}>
                    <Text style={[{fontSize: 14, color: "#333"}, label.textStyle]}>{label.text}</Text>
                    {rightCmp}
                </View>
            </TouchableOpacity>)
    }
}

const style = StyleSheet.create({
    container: {}
});

 